package com.spark.starter.config;

import com.spark.starter.inteceptor.IpStarterInteceptor;
import com.spark.starter.service.IpStarterService;
import com.spark.starter.service.impl.IpStarterServiceImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author sc
 * @DATE 2024/6/4 23:14
 * @Description:
 * @Version 1.0
 */
@Configuration
public class SpringConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(ipStarterService())
                .addPathPatterns("/**");
    }

    @Bean
    public IpStarterInteceptor ipStarterService(){
        return new IpStarterInteceptor();
    }
}
